<template>
    <div class="container">
        <MyComponent message="helloWorld" title="标题1" @changeToParent="getMsgFromChild"></MyComponent>
        <div>
            {{ cMsg }}
        </div>
        <hr>
        <MyComponent></MyComponent>
    </div>
 
   
</template>
<script lang='ts' setup>
import MyComponent from '@/components/MyComponent.vue';
import {ref} from 'vue'
const cMsg=ref<number|null>(null)
const getMsgFromChild=(arg:number)=>{
    console.log('父组件：',arg);
    cMsg.value=arg
    
}
</script>
<style lang='scss' scoped>
.container{
    height: 200px;
    border: 2px solid #000;
}
</style>

